package lv.accenture.ex07;

public class TestThreads {

        public static void main(String[] args) {
                HelloRunner1 r = new HelloRunner1();
                Thread t1 = new Thread(r, "R1");
                Thread t2 = new Thread(r, "R2");
                Thread t3 = new Thread(r, "R3");
                Thread t4 = new Thread(r, "R4");
                t1.start();
                t2.start();
                t3.start();
                t4.start();
        }
}

class HelloRunner1 implements Runnable {
        int count = 0;

        public void run() {
                while (count < 15000) {
                        synchronized (this) {
                                System.out.println("Hello #" + count + " from "
                                                + Thread.currentThread().getName());
                                count++;
                        }
                }
        }
}
